package com.fuchen.shengwu.service.report.controller;

import java.sql.*;

/**
 * Created by luganlin on 29/05/2018.
 */
public class testmain {
    public static void main(String[] argv) throws Exception{
        Connection conn = DriverManager.getConnection("jdbc:postgresql://localhost/shengwu_report", "ht", "ht");
        DatabaseMetaData md = conn.getMetaData();
        ResultSet rs = md.getTables(null, null, "%", null);
        ResultSetMetaData rsmd = rs.getMetaData();
        int columnsNumber = rsmd.getColumnCount();
        while (rs.next()) {
            String tableSchema = rs.getString("table_schem");
            String tableType = rs.getString("table_type");
            String tableName = rs.getString("table_name");

            if ("public".equals(tableSchema) && "TABLE".equals(tableType)) {
                System.out.println("table name:" + ":" + tableName);
            }


            //System.out.println();
            //System.out.println(rs.getString("TABLE_NAME"));
        }
    }
}
